﻿using System.Linq;

namespace BlogOutModell
{
    public class UserDB
    {
        private static readonly BlogOutModelContainer Context = DB.Context;

        public static User GetUser(int id)
        {
            return (Context.Users.Where(u => u.Id == id && !u.IsDeleted)).SingleOrDefault();
        }

        public static User ValidateUser(string loginName, string password)
        {
            return
                (Context.Users.Where(
                    u => u.LoginName == loginName && u.Password == password && !u.IsDeleted)).SingleOrDefault();
        }
    }
}